using Nop.Core.Domain.Directory;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Nop.Core.ApiDataModel
{
	public partial class RegionModel : ApiResult
	{
		public int Id { get; set; }

		public string Name { get; set; }

		public List<string> PostalCodes { get; set; }

		public RegionModel() { }

		public RegionModel(Region region)
		{
			Id = region.Id;
			Name = region.Name;
			PostalCodes = new List<string>();
			PostalCodes.AddRange(region.Districts.SelectMany(d=>d.Zones.SelectMany(z=>z.ZipPostalCode.Split('|'))));
		}
	}
}
